var webpack=require('webpack');
var path=require('path');

module.exports={
    entry:{
        bundle:"./scripts/app.js",
    },
    output:{
        path:path.resolve(__dirname,"./scripts/"),
        filename:"[name].js",
    },
    module:{
        rules:[
            {
                test:/.js?$/,
                exclude: /(node_modules)/,
                loader: "babel-loader",
            }
        ]
    },
    resolve: {
        extensions: ['.js','.json'],
        alias: {
            'jquery': "jquery/src/jquery"
        }
    },
    plugins: [
        new webpack.ProvidePlugin({
            $:"jquery",
            jQuery: "jquery",
        })
    ]
}
if (process.env.NODE_ENV === 'development') {
    module.exports.devtool = 'eval-source-map';
    module.exports.module.rules = (module.exports.module.rules || []).concat([
    ])
    module.exports.plugins = (module.exports.plugins || []).concat([
        new webpack.DefinePlugin({
            ENV_PRO: JSON.stringify(true)
        }),
    ])
}
if (process.env.NODE_ENV === 'production') {
    module.exports.plugins = (module.exports.plugins || []).concat([
        new webpack.DefinePlugin({
            ENV_PRO: JSON.stringify(true)
        }),
        new webpack.optimize.UglifyJsPlugin({
            sourceMap: false,
            compress: {
                warnings: false
            }
        }),
        new webpack.LoaderOptionsPlugin({
            minimize: true
        })
    ])
}